﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HML.Demo
{
    public partial class SingleAccordionStyle1EffectForm : ItemFormTemplate
    {
        public SingleAccordionStyle1EffectForm()
        {
            InitializeComponent();
            this.Load += new System.EventHandler(this.Form_Load);
            this.Shown += new System.EventHandler(this.Form_Shown);
        }

        #region 实现

        public override ItemFormTemplateViewObject AsynchRequestTask(ItemFormTemplateViewObject view)
        {
            System.Threading.Thread.Sleep(300);
            view.ViewData = DemoHelper.GetDescription(AppDomain.CurrentDomain.BaseDirectory + "例子\\控件效果\\手风琴\\SingleAccordionStyle1EffectForm.rtf");
            return view;
        }

        public override void DataBind(ItemFormTemplateViewObject viewObject)
        {
            this.introduceBrowser.Rtf = viewObject.ViewData.ToString();
        }

        public override void ShowView()
        {
            base.ShowView();
        }

        public override void HideView()
        {
            base.HideView();
        }

        public override void CloseView()
        {
            base.CloseView();
        }

        #endregion

        #region 属性面板

        /// <summary>
        /// 信息通知
        /// </summary>
        private Dictionary<string, string> infoDic = new Dictionary<string, string>() {
            {"Mailbox" ,"3"}
        };

        private void Form_Load(object sender, EventArgs e)
        {
            this.controlContainer.SizeChanged += this.ControlContainer_SizeChanged;


            List<SingleAccordionNode> nodeList = new List<SingleAccordionNode>();
            {
                nodeList.Add(new HML.SingleAccordionLabelNode() { Text = "MAIN" });

                nodeList.Add(new HML.SingleAccordionContentNode() { Text = "Dashboard", ImageVisible = SingleAccordionNodeImageVisibles.True, ImageLRMargin = new LRMargin(8, 8), Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_Dashboard, TextLRMargin = new LRMargin(0, 0) });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode1 = new HML.SingleAccordionCategoryNode() { Text = "Access Pages", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_AccessPages };
                nodeList.Add(singleAccordionCategoryNode1);
                singleAccordionCategoryNode1.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Login" });
                singleAccordionCategoryNode1.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Registration" });
                singleAccordionCategoryNode1.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "404" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode2 = new HML.SingleAccordionCategoryNode() { Text = "Layouts", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_Layouts };
                nodeList.Add(singleAccordionCategoryNode2);
                singleAccordionCategoryNode2.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Default Layout" });
                singleAccordionCategoryNode2.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Collapsed Menu" });
                singleAccordionCategoryNode2.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Chat Open" });
                singleAccordionCategoryNode2.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Boxed Layout" });
                singleAccordionCategoryNode2.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Boxed Collapsed Menu" });
                singleAccordionCategoryNode2.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Boxed Chat Open" });

                nodeList.Add(new HML.SingleAccordionLabelNode() { Text = "APPLICATIONS" });

                nodeList.Add(new HML.SingleAccordionContentNode() { Text = "Calendar", ImageVisible = SingleAccordionNodeImageVisibles.True, ImageLRMargin = new LRMargin(8, 8), Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_Calendar, TextLRMargin = new LRMargin(0, 0) });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode3 = new HML.SingleAccordionCategoryNode() { Text = "Mailbox", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_Mailbox };
                nodeList.Add(singleAccordionCategoryNode3);
                singleAccordionCategoryNode3.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Inbox" });
                singleAccordionCategoryNode3.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Compose" });
                singleAccordionCategoryNode3.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "View" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode4 = new HML.SingleAccordionCategoryNode() { Text = "Chat API", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_ChatAPI };
                nodeList.Add(singleAccordionCategoryNode4);
                singleAccordionCategoryNode4.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Chat API" });
                singleAccordionCategoryNode4.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Chat Windows" });

                nodeList.Add(new HML.SingleAccordionLabelNode() { Text = "DATA VISUALIZATION" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode5 = new HML.SingleAccordionCategoryNode() { Text = "Echarts", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_Echarts };
                nodeList.Add(singleAccordionCategoryNode5);
                singleAccordionCategoryNode5.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Line & Area Charts" });
                singleAccordionCategoryNode5.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Bar & Stacked Charts" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode6 = new HML.SingleAccordionCategoryNode() { Text = "Morris Charts", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_Morris_Charts };
                nodeList.Add(singleAccordionCategoryNode6);
                singleAccordionCategoryNode6.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Line Charts" });
                singleAccordionCategoryNode6.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Bar & Stacked Charts" });
                singleAccordionCategoryNode6.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Area Charts" });
                singleAccordionCategoryNode6.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Pie Charts" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode7 = new HML.SingleAccordionCategoryNode() { Text = "Charts JS", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_ChartsJS };
                nodeList.Add(singleAccordionCategoryNode7);
                singleAccordionCategoryNode7.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Line Charts" });
                singleAccordionCategoryNode7.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Bar Charts" });
                singleAccordionCategoryNode7.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Pie & Donut" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode8 = new HML.SingleAccordionCategoryNode() { Text = "Flot Charts", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_FlotCharts };
                nodeList.Add(singleAccordionCategoryNode8);
                singleAccordionCategoryNode8.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Area Charts" });
                singleAccordionCategoryNode8.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Line Charts" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode9 = new HML.SingleAccordionCategoryNode() { Text = "Sparkline Charts", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_singleAccordion_Style1_SparklineCharts };
                nodeList.Add(singleAccordionCategoryNode9);
                singleAccordionCategoryNode9.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Line & Area Charts" });
                singleAccordionCategoryNode9.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Bar Charts" });
                singleAccordionCategoryNode9.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Composite Charts" });

                nodeList.Add(new HML.SingleAccordionLabelNode() { Text = "USER INTERFACE" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode10 = new HML.SingleAccordionCategoryNode() { Text = "Ui Elements", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_UiElements };
                nodeList.Add(singleAccordionCategoryNode10);
                singleAccordionCategoryNode10.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Timeline" });
                singleAccordionCategoryNode10.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Pricing Tables" });
                singleAccordionCategoryNode10.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Icon Sets" });
                singleAccordionCategoryNode10.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Form Elements" });
                singleAccordionCategoryNode10.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Form Wizard" });
                singleAccordionCategoryNode10.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Form Validations" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode11 = new HML.SingleAccordionCategoryNode() { Text = "Components", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_Components };
                nodeList.Add(singleAccordionCategoryNode11);
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Tabs" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Accordions" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Progress Bars" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Buttons" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Modals" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Alerts" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Notifications" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Tooltips" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Popovers" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Navbars" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Dropdowns" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Breadcrumbs" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Pagination" });
                singleAccordionCategoryNode11.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Labels & Badges" });

                HML.SingleAccordionCategoryNode singleAccordionCategoryNode12 = new HML.SingleAccordionCategoryNode() { Text = "Appearance", ImageVisible = SingleAccordionNodeImageVisibles.True, Image = global::HML.Demo.Properties.Resources.控件效果_SingleAccordion_Style1_Appearance };
                nodeList.Add(singleAccordionCategoryNode12);
                singleAccordionCategoryNode12.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Typography" });
                singleAccordionCategoryNode12.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Grids" });
                singleAccordionCategoryNode12.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Draggable Panels" });
                singleAccordionCategoryNode12.Childrens.Add(new HML.SingleAccordionContentNode() { Text = "Group Listing" });
            }
            this.demo_control.Size = new Size((int)Math.Ceiling(225 * this.demo_control.ScaleDpi), (int)Math.Ceiling(580 * this.demo_control.ScaleDpi));
            this.demo_control.BackColor = System.Drawing.Color.Transparent;
            this.demo_control.Font = new System.Drawing.Font("Bahnschrift SemiBold", 9.5F);
            this.demo_control.LabelNodeStyle.TextLRMargin = new LRMargin(8, 0);
            this.demo_control.StyleAppearance.LabelNode.Enter.BackColor = System.Drawing.Color.Transparent;
            this.demo_control.StyleAppearance.LabelNode.Normal.BackColor = System.Drawing.Color.Transparent;
            this.demo_control.CategoryNodeStyle.ImageLRMargin = new LRMargin(8, 8);
            this.demo_control.CategoryNodeStyle.TextLRMargin = new LRMargin(0, 0);
            this.demo_control.StyleAppearance.CategoryNode.Enter.BackColor = System.Drawing.Color.FromArgb(28, 33, 33, 33);
            this.demo_control.StyleAppearance.CategoryNode.Normal.BackColor = System.Drawing.Color.Transparent;
            this.demo_control.StyleAppearance.CategoryNode.Normal.FoldColor = System.Drawing.Color.FromArgb(150, 255, 255, 255);
            this.demo_control.StyleAppearance.CategoryNode.Enter.FoldColor = System.Drawing.Color.FromArgb(150, 255, 255, 255);
            this.demo_control.StyleAppearance.CategoryNode.SplitterLineColor = System.Drawing.Color.Transparent;
            this.demo_control.ContentNodeStyle.TextLRMargin = new LRMargin(30, 0);
            this.demo_control.StyleAppearance.ContentNode.Enter.BackColor = System.Drawing.Color.Transparent;
            this.demo_control.StyleAppearance.ContentNode.Normal.BackColor = System.Drawing.Color.Transparent;
            this.demo_control.StyleAppearance.ContentNode.Selected.BackColor = System.Drawing.Color.Transparent;
            this.demo_control.ContentNodeStyle.LRAnimationDistance = 0;
            this.demo_control.ContentNodeStyle.MouseAnimationAllTimer = 400;
            this.demo_control.StyleAppearance.ContentNode.Normal.TextColor = System.Drawing.Color.FromArgb(194, 189, 189);
            this.demo_control.StyleAppearance.ContentNode.Selected.TextColor = System.Drawing.Color.White;
            this.demo_control.ScrollBar.AutoHide = true;
            this.demo_control.Nodes.Clear();
            this.demo_control.Nodes.AddRange(nodeList.ToArray());
            this.demo_control.BackgroundDrawBefore += this.Demo_control_BackgroundDrawBefore;
            this.demo_control.NodeDrawBefore += this.Demo_control_NodeDrawBefore;
            this.demo_control.NodeDrawAfter += this.Demo_control_NodeDrawAfter;
            this.demo_control.NodeClick += this.Demo_control_NodeClick;

        }

        private void Form_Shown(object sender, EventArgs e)
        {
            this.splitContainer.SplitterDistance = Math.Max(this.splitContainer.Width / 4, this.splitContainer.Width - MainForm.GlobalSplitWidth);
            this.splitContainer.SplitterMoved += this.SplitContainer_SplitterMoved;

            MainForm.LoadAssistTabControl(this.assistTabControl);
        }

        private void SplitContainer_SplitterMoved(object sender, SplitterEventArgs e)
        {
            SplitContainer control = (SplitContainer)sender;
            MainForm.GlobalSplitWidth = this.splitContainer.Width - control.SplitterDistance;
        }

        private void ControlContainer_SizeChanged(object sender, EventArgs e)
        {
            Panel control = (Panel)sender;
            this.demo_control.Height = Math.Min(1000, (control.Height - 80));
            this.demo_control.Location = new Point((control.Width - this.demo_control.Width) / 2, (control.Height - this.demo_control.Height) / 2);
        }

        private void Demo_control_BackgroundDrawBefore(object sender, SingleAccordionBackgroundDrawBeforeEventArgs e)
        {
            Graphics g = e.Graphics;

            //渐变背景
            LinearGradientBrush back_sb = new LinearGradientBrush(e.Bounds_C, Color.FromArgb(230, 49, 126, 206), Color.FromArgb(230, 116, 84, 169), LinearGradientMode.Vertical);
            g.FillRectangle(back_sb, e.Bounds_C);
            back_sb.Dispose();

            //取消控件默认绘制
            e.Cancel = true;
        }

        private void Demo_control_NodeDrawBefore(object sender, SingleAccordionNodeDrawBeforeEventArgs e)
        {
            //类别节点 背景色修改
            if (e.Node is SingleAccordionCategoryNode)
            {
                //为展开状态
                if (((SingleAccordionCategoryNode)e.Node).Expand)
                {
                    e.BackBrush.Color = Color.FromArgb(28, 33, 33, 33);
                }
            }

            //内容节点 背景色修改
            if (e.Node is SingleAccordionContentNode)
            {
                //为选中状态
                if (((SingleAccordion)sender).SelectedNode == e.Node)
                {
                    e.BackBrush.Color = Color.FromArgb(28, 33, 33, 33);
                }
                else
                {
                    //鼠标进入状态
                    if (e.Node.MouseAnimationStatus == SingleAccordionNodeMouseAnimationStatuss.MouseEnter)
                    {
                        e.BackBrush.Color = Color.FromArgb(28, 33, 33, 33);
                    }
                    //鼠标进入状态
                    else if (e.Node.MouseAnimationStatus == SingleAccordionNodeMouseAnimationStatuss.MouseEntering)
                    {
                        double progress = AnimationHelper.EaseOut(e.Node.MouseAnimationUsedTime, e.Node.GetMouseAnimationAllTime(), 2.0);
                        int a = Math.Max(byte.MinValue, Math.Min(byte.MaxValue, (int)Math.Ceiling(28 * progress)));
                        e.BackBrush.Color = Color.FromArgb(a, 33, 33, 33);
                    }
                    //鼠标离开状态
                    else if (e.Node.MouseAnimationStatus == SingleAccordionNodeMouseAnimationStatuss.MouseLeaveing)
                    {
                        double progress = 1 - AnimationHelper.EaseOut(e.Node.MouseAnimationUsedTime, e.Node.GetMouseAnimationAllTime(), 2.0);
                        int a = Math.Max(byte.MinValue, Math.Min(byte.MaxValue, (int)Math.Ceiling(28 * progress)));
                        e.BackBrush.Color = Color.FromArgb(a, 33, 33, 33);
                    }
                    //鼠标离开状态
                    else if (e.Node.MouseAnimationStatus == SingleAccordionNodeMouseAnimationStatuss.MouseLeave)
                    {

                    }
                }

            }
        }

        private void Demo_control_NodeDrawAfter(object sender, SingleAccordionNodeDrawAfterEventArgs e)
        {
            //类别节点绘制竖线效果
            if (e.Node is SingleAccordionCategoryNode)
            {
                if (((SingleAccordionCategoryNode)e.Node).Expand)
                {
                    e.BackBrush.Color = Color.FromArgb(8, 220, 210);

                    Graphics g = e.Graphics;
                    g.FillRectangle(e.BackBrush, new RectangleF(e.Bounds_C.X, e.Bounds_C.Y, (int)Math.Ceiling(2 * e.Dpi), e.Bounds_C.Height));
                }
            }

            //内容节点绘制竖线效果
            if (e.Node is SingleAccordionContentNode)
            {
                if (((SingleAccordion)sender).SelectedNode == e.Node)
                {
                    e.BackBrush.Color = Color.FromArgb(77, 156, 248);

                    Graphics g = e.Graphics;
                    g.FillRectangle(e.BackBrush, new RectangleF(e.Bounds_C.X, e.Bounds_C.Y, (int)Math.Ceiling(2 * e.Dpi), e.Bounds_C.Height));
                }
                else
                {
                    //鼠标进入状态
                    if (e.Node.MouseAnimationStatus == SingleAccordionNodeMouseAnimationStatuss.MouseEnter)
                    {
                        e.BackBrush.Color = Color.FromArgb(77, 156, 248);
                        Graphics g = e.Graphics;
                        g.FillRectangle(e.BackBrush, new RectangleF(e.Bounds_C.X, e.Bounds_C.Y, (int)Math.Ceiling(2 * e.Dpi), e.Bounds_C.Height));
                    }
                    //鼠标进入状态
                    else if (e.Node.MouseAnimationStatus == SingleAccordionNodeMouseAnimationStatuss.MouseEntering)
                    {
                        double progress = AnimationHelper.EaseOut(e.Node.MouseAnimationUsedTime, e.Node.GetMouseAnimationAllTime(), 2.0);
                        int a = Math.Max(byte.MinValue, Math.Min(byte.MaxValue, (int)Math.Ceiling(255 * progress)));
                        e.BackBrush.Color = Color.FromArgb(a, 77, 156, 248);

                        Graphics g = e.Graphics;
                        g.FillRectangle(e.BackBrush, new RectangleF(e.Bounds_C.X, e.Bounds_C.Y, (int)Math.Ceiling(2 * e.Dpi), e.Bounds_C.Height));
                    }
                    //鼠标离开状态
                    else if (e.Node.MouseAnimationStatus == SingleAccordionNodeMouseAnimationStatuss.MouseLeaveing)
                    {
                        double progress = 1 - AnimationHelper.EaseOut(e.Node.MouseAnimationUsedTime, e.Node.GetMouseAnimationAllTime(), 2.0);
                        int a = Math.Max(byte.MinValue, Math.Min(byte.MaxValue, (int)Math.Ceiling(28 * progress)));
                        e.BackBrush.Color = Color.FromArgb(a, 77, 156, 248);

                        Graphics g = e.Graphics;
                        g.FillRectangle(e.BackBrush, new RectangleF(e.Bounds_C.X, e.Bounds_C.Y, (int)Math.Ceiling(2 * e.Dpi), e.Bounds_C.Height));
                    }
                    //鼠标离开状态
                    else if (e.Node.MouseAnimationStatus == SingleAccordionNodeMouseAnimationStatuss.MouseLeave)
                    {

                    }

                }
            }

            //为 Mailbox 内容节点添加 信息通知
            for (int i = 0; i < this.infoDic.Count; i++)
            {
                if (this.infoDic.Keys.Contains(e.Node.Text))
                {
                    Graphics g = e.Graphics;

                    SingleAccordion sa = (SingleAccordion)sender;
                    SolidBrush brush = new SolidBrush(Color.Tomato);
                    NativeMethods.TEXTMETRIC font_metrics = ControlHelper.GetFontMetrics(this.Handle, sa.Font);
                    Size text_size = new Size((int)Math.Ceiling(g.MeasureString(this.infoDic[e.Node.Text], sa.Font, int.MaxValue, StringFormat.GenericTypographic).Width), font_metrics.GetFontRealHeight());
                    int rect_width = Math.Max(text_size.Width, e.FoldBounds_C.Height) + 6;
                    RectangleF text_rect = new RectangleF(e.FoldBounds_C.X - 10 - rect_width, e.Bounds_C.Y + (e.Bounds_C.Height - rect_width) / 2, rect_width, rect_width);
                    PointF text_point = new PointF(text_rect.X + (text_rect.Width - text_size.Width) / 2, text_rect.Y + (text_rect.Height - text_size.Height) / 2);

                    SmoothingMode sm = g.SmoothingMode;
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    g.FillEllipse(brush, text_rect);
                    g.SmoothingMode = sm;

                    brush.Color = Color.White;
                    g.DrawString(this.infoDic[e.Node.Text], sa.Font, brush, text_point, StringFormat.GenericTypographic);

                    brush.Dispose();

                    break;
                }
            }
        }

        private void Demo_control_NodeClick(object sender, SingleAccordionNodeEventArgs e)
        {
            //单击节点清除信息通知
            string key = "";
            for (int i = 0; i < this.infoDic.Count; i++)
            {
                if (this.infoDic.Keys.Contains(e.Node.Text))
                {
                    key = e.Node.Text;
                    break;
                }
            }
            if (key != "")
            {
                this.infoDic.Remove(key);
            }
            ((SingleAccordion)sender).Invalidate();
        }

        #endregion

    }
}
